package it.unibo.imola.parser.visitor.entity;

public class GlobalThresStatement extends BuiltinCallStatement {

	public GlobalThresStatement(ToolBox toolbox) {
		super("GLOBAL_THRES", toolbox);
	}

	@Override
	public boolean check(GlobalEnvironment gEnv, Environment env) throws Exception {
		if(!super.check(gEnv, env))
			return false;
		if (actualParametersList.get(2) instanceof Integer) {
			if ((Integer) actualParametersList.get(2) < 0 || (Integer) actualParametersList.get(2) > 255)
				throw new Exception("specified threshold is not in range [0-255]");
		}
		return true;
	}
}
